<!DOCTYPE html>
<html lang="en" data-ng-app="App">

<head>
    <meta charset="UTF-8">

    <title>云图轨道交通数据管理系统-登录</title>
    <link rel="stylesheet" href="/StyleSheets/font-awesome.css">
    <link rel="stylesheet" href="/StyleSheets/authentication/style.css">
</head>

<body data-ng-controller="homeCtrl">
    <div id="login-container">
        <div id="sgidi">
            用户登录
        </div>
        <div class="divider"></div>
        <div class="form-wrapper" id="form-wrapper">
            <form action="/login" method="post" enctype="application/x-www-form-urlencoded">
                <div class="input-section">
                    <label for="username">
                        用户名 <i class="fa fa-user"></i>
                    </label>
                    <input id="username" type="text" name="username" required placeholder="用户名">
                </div>
                <div class="input-section">
                    <label for="password">
                        密码 <i class="fa fa-lock"></i>
                    </label>
                    <input type="password" name="password" required placeholder="输入你的密码">
                </div>
                <div class="input-section">
                    <label for="username">
                        &nbsp;
                    </label>
                    <input type="submit" class="submit-btn" id="login" value="登录" data-ng-click="login($event)">
                    <a href="/register1" class="register-btn">申请一个账号</a>
                </div>
            </form>
        </div>

    </div>
    <footer>©2014-2015 上海岩土工程勘察设计研究院有限公司-地理信息所版权所有</footer>
</body>
<script src="http://cdn.staticfile.org/angular.js/1.3.0-beta.13/angular.min.js"></script>
<script>
var app = angular.module('App', []);
app.controller('homeCtrl', ['$scope', '$timeout', function($scope, $timeout) {

    function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
            var c = ca[i];
            while (c.charAt(0) == ' ') c = c.substring(1, c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
        }
        return null;
    }
    var username = readCookie('username') ? decodeURI(readCookie('username')) : "";
    document.getElementById('username').setAttribute('value', username);

    $scope.login = function(event) {
        event.preventDefault();
        var loginBtn = document.getElementById('form-wrapper');
        angular.element(loginBtn).addClass('shake');
        $timeout(function() {
            angular.element(loginBtn).removeClass('shake');
        }, 1000);
    };


}]);
</script>

</html>
